package cn.quevo.core.file.draw.impl;

import cn.quevo.core.exception.CustomException;
import cn.quevo.core.file.draw.AbstractCodeDraw;
import cn.quevo.core.file.entity.WriteImage;

import java.awt.*;
import java.util.Random;

public class RandomLineDraw extends AbstractCodeDraw {
    @Override
    protected void checked(Graphics2D gd, WriteImage writeImage) throws CustomException {
        Random random = new Random();
        for (int i = 0; i < writeImage.getInterLine(); i++) {
            gd.setColor(new Color(random.nextInt(255 + 1), random.nextInt(255 + 1), random.nextInt(255 + 1)));
            gd.drawLine(random.nextInt(writeImage.getWidth()), random.nextInt(writeImage.getHeight()), random.nextInt(writeImage.getWidth()), random.nextInt(writeImage.getHeight()));
        }
    }
}
